﻿<UserControl x:Class="Hisaab.Windows.Client.View.AccountEditorView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d"
             xmlns:conv="clr-namespace:Hisaab.Windows.Client.Converters" d:Height="452" d:Width="572" >
    <UserControl.Resources>
        <conv:VisibleToBoolConverter x:Key="VisibilityConverter" />
    </UserControl.Resources>
    <Grid Margin="8" >
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="100" />
            <ColumnDefinition Width="4" />
            <ColumnDefinition Width="250" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="36" />
            <RowDefinition Height="36" />
            <RowDefinition Height="36" />
            <RowDefinition Height="36" />
            <RowDefinition Height="36" />
            <RowDefinition Height="239*" />
        </Grid.RowDefinitions>
        <Label Grid.Column="0" Grid.Row="1" FontWeight="Bold" Style="{DynamicResource EditorLabel}">Title</Label>
        <TextBox Grid.Column="2" Grid.Row="1" Text="{Binding Path=SelectedAccount.Name, Mode=TwoWay}" Style="{DynamicResource EditorTextBox}" />
        <Label Grid.Column="0" Grid.Row="2" Style="{DynamicResource EditorLabel}">Account Type</Label>
        <ComboBox Grid.Column="2" Grid.Row="2"
            ItemsSource="{Binding Path=AccountTypes}"
            SelectedValuePath="Id"
            SelectedValue="{Binding Path=SelectedAccount.AccountType}" Style="{DynamicResource EditorComboBox}">
            <ComboBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Name}" />
                </DataTemplate>
            </ComboBox.ItemTemplate>
        </ComboBox>
        <Label Content="Initial Balance " Grid.Row="3" Style="{DynamicResource EditorLabel}" Visibility="{Binding IsNewAccount, Converter={StaticResource VisibilityConverter}}" />
        <TextBox Grid.Column="2" Grid.Row="3" Text="{Binding Path=SelectedAccount.InitialBalance, Mode=TwoWay}" Visibility="{Binding IsNewAccount, Converter={StaticResource VisibilityConverter}}" Style="{DynamicResource EditorTextBox}" />

        <Label Content="Start Date" Grid.Row="4" Style="{DynamicResource EditorLabel}" Visibility="{Binding IsNewAccount, Converter={StaticResource VisibilityConverter}}" />
        <DatePicker Grid.Column="2" Grid.Row="4" Style="{DynamicResource EditorDatePicker}"
			Visibility="{Binding IsNewAccount, Converter={StaticResource VisibilityConverter}}"
            SelectedDate="{Binding Path=SelectedAccount.InitialBalanceDate, Mode=TwoWay}" />
    </Grid>
</UserControl>